﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <link rel="shortcut icon" href="favicon.ico">
    <link rel="icon" type="image/gif" href="~/img/animated_favicon1.gif">
    <meta name="viewport" content="width=device-width" />
    <link href="~/UILibs/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="~/UILibs/easyui/themes/icon.css" rel="stylesheet" />
    <link href="~/Css/css.css" rel="stylesheet" />

    <script src="~/Scripts/jquery-1.7.1.min.js"></script>
    <script src="~/UILibs/easyui/jquery.easyui.min.js"></script>
    <script src="~/UILibs/easyui/locale/easyui-lang-zh_CN.js"></script>

    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <title></title>
    <script type="text/javascript">
        $(function () {
            if ($("#shopName").combobox('getValue') == 0) {
                $("#shopName").combobox('setValue', "")
            }
            //
            $("#shopName").combobox({
                url: pageConfig.getShopName,
                //action 
                valueField: "shopID",
                textField: "shopName"
            });

            if ($("#areaName").combobox('getValue') == 0) {
                $("#areaName").combobox('setValue', "")
            }
            //
            $("#areaName").combobox({
                url: pageConfig.getAreaName,
                //action 
                valueField: "AreaID",
                textField: "AreaName"
            });

            //加载数据列表
            $("#data").datagrid({
                fit: true,
                title: '货架商品统计',
                halign: 'center',
                striped: true,
                rownumbers: true,
                columns:
                    [[{
                        field: 'ck',
                        checkbox: true
                    }, {
                        field: 'waresCode',        //waresCode  waresName waresPrice waresBid waresUnit waresSpec waresSum
                        title: '商品编码',
                        width: 160,
                        halign: 'center',
                    
                        align: 'center'
                    }, {
                        field: 'waresName',
                        title: '商品名称',
                        width: 200,
                        halign: 'center',
                        align: 'center'

                    }, {
                        field: 'waresPrice',
                        title: '商品售价',
                        width: 100,
                        halign: 'center',
                        align: 'center',
                     
                    }, {
                        field: 'waresBid',
                        title: '商品进价',
                        width: 100,
                        halign: 'center',
                        align: 'center'
                    }, {
                        field: 'waresUnit',
                        title: '商品单位',
                        width: 100,
                        halign: 'center',
                        align: 'center'

                    }, {
                        field: 'waresSpec',
                        title: '商品规格',
                        width: 100,
                        halign: 'center',
                        align: 'center'

                    }, {
                        field: 'waresSum',
                        title: '商品总数',
                        sortable: true,
                        width: 120,
                        halign: 'center',
                        align: 'center'
                    }, ]],
                url: pageConfig.getAction,
                pagination: true,
                pageSize: 25,
                pageList: [25, 30, 35],
                sortName: 'waresSum',
                sortOrder: 'asc',
                toolbar: '#tool',
                queryParams: {
                    waresName: $("#txtName").val(),
                    waresCode: $("#txtCode").val(),
                    storeid: $("#shopName").combobox('getValue'),
                    areaid: $("#areaName").combobox('getValue'),
                },
                //行的格式 单元格的格式  waresName   waresCode
                rowStyler: function (index, row) {
                    if (row.waresSum <=1) {
                        return 'background-color:red;color:yellow;font-weight:bold;';
                    }
                },
            });
            $("#formdialog").dialog({
                width: 400,
                height: 356,
                closed: true,
                modal: true,
                buttons: '#btns'
            });

        });
        var pageConfig = {
            getAction: '@Url.Action("GetTest")',
            getShopName: '@Url.Action("GetShopName")',
            getAreaName: '@Url.Action("GetAreaName")',
        };

        function searchData() {
            $("#data").datagrid('load', {
                waresCode: $("#txtCode").val(),
                waresName: $("#txtName").val(),
                storeid: $("#shopName").combobox('getValue'),
                areaid: $("#areaName").combobox('getValue'),
            });
        }
        function excel111() {
            window.location.href = "/ProductStatic/ExportExcel?storeid=" + $("#shopName").combobox('getValue') + '&areaid=' + $("#areaName").combobox('getValue');
        }
    </script>
</head>
<body class="easyui-layout" style="width: 100%; height: 100%">
    <div data-options="region:'center'">
        <table id="data"></table>

    </div>
    <div id="tool" style="padding: 20px;">

        <div style="margin-top: 5px">
            商品编号：<input id="txtCode" type="text" onchange="searchData()" />
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
                商品名称：<input id="txtName" type="text" onchange="searchData()" />
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
            请选择查询区域名称：
                 <input id="areaName" class="easyui-combobox" name="areaName" />
            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
             请选择查询店铺名称：
                 <input id="shopName" class="easyui-combobox" name="shopName" />&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp


            <a class="easyui-linkbutton" iconcls="icon-search" onclick="searchData()">查询</a>

            &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp

            <a class="easyui-linkbutton" iconcls="icon-print" onclick="excel111();">导出Excel</a>
            <p>
                <span style="font-size: larger; color: red">&nbsp&nbsp&nbsp  &nbsp&nbsp&nbsp &nbsp&nbsp&nbsp   注意：默认显示仓库的商品数量</span>
            </p>
        </div>
    </div>
</body>
</html>
